`use strict`
let Koa = require('koa');

let bodyparser = require('koa-bodyparser');
let controller = require('./controllers');

const koa_static = require('koa-static');
let templating=require('./templating');
let model=require('./models');


let app = new Koa();

app.use(koa_static(__dirname));

app.use(bodyparser());
app.use(templating);
app.use(controller());

(async ()=>{
    console.log('初始化数据库');
    await model.sync()
});


let port = 4000;
app.listen(port);

console.log(`http://127.0.0.1:${port}`);